package iterator;

/**
 * 迭代器模式
 */
public class Client {

    public static void main(String[] args) {
        Aggregate aggregate = new ConcreteAggregate(20);
        aggregate.add("A");
        aggregate.add("B");
        aggregate.add("C");
        Iterator iterator = aggregate.createIterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }
}
